package com.feign.wugongbang.service;

import com.feign.wugongbang.config.FeignFullLogConfiguration;
import com.feign.wugongbang.config.FeignMultipartSupportConfig;
import com.feign.wugongbang.entity.WgbFeedback;
import com.feign.wugongbang.hystric.ErrorCollctionServiceHystric;
import com.feign.wugongbang.hystric.FeedbackServiceHystric;
import com.feign.wugongbang.utils.Constants;
import com.feign.wugongbang.utils.PageInfo;
import feign.Headers;
import feign.Param;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;

import static org.springframework.web.bind.annotation.RequestMethod.PUT;

/**
 * Created by Administrator on 2017/5/24.
 */
@FeignClient(name = "${service.name.wugongbang:"+Constants.SERVICE_NAME+"}",configuration = FeignMultipartSupportConfig.class,fallback = FeedbackServiceHystric.class)
public interface FeedbackService {

    String PRE_URL = Constants.CODE_VERSION + "/feedbacks";

    @RequestMapping(value = PRE_URL + "/", method = RequestMethod.POST,produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    Object add(@RequestPart(value = "uploadfile") MultipartFile uploadfile,@RequestHeader(value = "USER_TOKEN") String userToken,@RequestParam Map<String,Object> params);

    @RequestMapping(value = PRE_URL + "/findFeedbacks", method = RequestMethod.POST)
    Object get(@RequestBody PageInfo pageInfo);

    @RequestMapping(value = PRE_URL + "/{id}", method = PUT)
    Object update(@PathVariable(value = "id") int id);

}
